Interview Questions and Answer
Options:
a. The servlet container (i.e. web server) calls the service() method to handle requests coming from the client.
b. Each time the server receives a request for a servlet, the server spawns a new thread and calls service.
c. The service() method checks the HTTP request type (GET, POST, PUT, DELETE, etc.) and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate.
d. All of the above.
Reveal Answer
Options:
a. request.getParameter()
b. request.getParameterValues()
c. request.getParameterNames()
d. None of the above.
Reveal Answer
Options:
a. response.getAttributeNames()
b. request.getAttributeNames()
c. Header.getAttributeNames()
d. None of the above.
Reveal Answer
Options:
a. Header.getProtocol()
b. response.getProtocol()
c. request.getProtocol()
d. None of the above.
Reveal Answer
Options:
a. response.encodeRedirectURL(url)
b. request.encodeRedirectURL(url)
c. Header.encodeRedirectURL(url)
d. None of the above.
Reveal Answer
Options:
a. request.addCookie(cookie)
b. response.addCookie(cookie)
c. Header.addCookie(cookie)
d. None of the above.
Reveal Answer
Options:
a. Authentication Filters.
b. Data compression Filters.
c. Encryption Filters.
d. All of the above.
Reveal Answer
Options:
a. javax.servlet.error.status_code
b. javax.servlet.error.exception_type
c. javax.servlet.error.message
d. All of the above.
Reveal Answer
Options:
a. response.deleteCookie(cookie);
b. cookie.setMaxAge(0);
c. request.deleteCookie(cookie);
d. None of the above
Reveal Answer
Options:
a. session.setIntHeader("Refresh", 5)
b. response.setIntHeader("Refresh", 5)
c. request.setIntHeader("Refresh", 5)
d. None of the above.
Reveal Answer
Options:
a. The servlet container (i.e. web server) calls the service() method to handle requests coming from the client.
b. Each time the server receives a request for a servlet, the server spawns a new thread and calls service.
c. The service() method checks the HTTP request type (GET, POST, PUT, DELETE, etc.) and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate.
d. All of the above.
Reveal Answer
Options:
a. response.setContentType()
b. request.setContentType()
c. writer.setContentType()
d. None of the above.
Reveal Answer
Options:
a. response.getWriter()
b. request.getWriter()
c. new PrintWriter()
d. None of the above.
Reveal Answer
Options:
a. Header.getMethod()
b. response.getMethod()
c. request.getMethod()
d. None of the above.
Reveal Answer
Options:
a. request.getRequestedSessionId()
b. response.getRequestedSessionId()
c. Header.getRequestedSessionId()
d. None of the above.
Reveal Answer
Options:
a. request.addHeader(name,value)
b. response.addIntHeader(name,value)
c. Header.addDateHeader(name,value)
d. None of the above.
Reveal Answer
Options:
a. request.setContentLength(length)
b. response.setContentLength(length)
c. header.setContentLength(length)
d. None of the above.
Reveal Answer
Options:
a. This attribute gives exact error message which can be stored and analysed after storing in a java.lang.String data type.
b. This attribute gives information about exception type which can be stored and analysed after storing in a java.lang.Class data type.
c. This attribute gives status code which can be stored and analysed after storing in a java.lang.Integer data type.
d. This attribute gives information about URL calling the servlet and it can be stored and analysed after storing in a java.lang.String data type.
Reveal Answer
Options:
a. session.addAttribute(name,value)
b. session.setAttribute(name,value)
c. session.createAttribute(name,value)
d. None of the above.
Reveal Answer
Options:
a. session.addAttribute(name,value)
b. session.setAttribute(name,value)
c. session.createAttribute(name,value)
d. None of the above.
Reveal Answer
Options:
a. session.setIntHeader("Refresh", 5)
b. response.setIntHeader("Refresh", 5)
c. request.setIntHeader("Refresh", 5)
d. None of the above.
Reveal Answer
Bestdotnet google plus